This function checks to see if a key exists in the currently open ini. This is not a necessary check to prevent errors as, when a key does not exist, reading from a non-existent key will just return a defaulted value. It can be useful to see if an ini file has saved specific data and a few other things, however.
ini_key_exists(section, key);
| Argument | Description |
|---|---|
| section | The section in the open .ini file to check a key in. |
| key | The key to check for. |
N/A
ini_open("savedata.ini");
if !ini_key_exists("save1", "name")
{
global.name = "Player1";
}
ini_close();
This will set variable global.name to "Player1" if no such key as "name" exists.